package com.yk.ykmessagesdk.utils;


import com.yk.ykmessagesdk.constant.CodeConstant;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;

public class SignUtils {
    public static String sign(String stringBuffer, String secretKey) {
        int length = 0;
        try {
            String bigInteger = new BigInteger(1, MessageDigest.getInstance("MD5")
                    .digest((stringBuffer + secretKey).getBytes(StandardCharsets.UTF_8))).toString(16);
            while (true) {
                String str3 = bigInteger;
                length = str3.length();
                if (length >= 32) {
                    return str3;
                }
                bigInteger = "0" + str3;
            }
        } catch (Exception unused) {
            return secretKey;
        }
    }

}
